<div class="page-header">
    <h1>
        直播单据信息列表
        <small>
            <i class="ace-icon fa fa-angle-double-right"></i>
        </small>
    </h1>
</div>
<div class="row">
    <div class="col-xs-12">
        <table id="dtpList" class="dataTable">
            <tfoot>
            <tr>
                <td colspan="5">本页合计：</td>
                <td>
                    <span name="Coin" class="tooltip-"/>
                </td>
                <td>
                    <span name="Gift" class="tooltip-"/>
                </td>
                <td>
                    <span name="Guardian" class="tooltip-"/>
                </td>
                <td>
                    <span name="Horn" class="tooltip-"/>
                </td>
                <td>
                    <span name="Duration"/>
                </td>
                <td colspan="2"></td>
            </tr>
            </tfoot>
        </table>
        <div id="dtpList_filter" class="dataTables_filter">
            <div>
                <select id="dtpList_F_SType" class="selectpicker" data-style="btn btn-info btn-sm" data-width="90px">
                    <option value="">模糊查询</option>
                    <option data-divider="true"></option>
                    <option value="Order_No">单据号</option>
                    <option value="User_ID">艺人ID</option>
                    <option value="User_NickName">艺人昵称</option>
                    <option value="User_RealName">艺人姓名</option>
                    <option value="Family_Name">公会名</option>
                </select>
                <input id="dtpList_F_SValue" class="fvalue" type="text"/>
                <select id="dtpList_F_Family" style="width: 126px;" data-databind="Family"></select>
                <select id="dtpList_F_DateType">
                    <option value="Create_Date">开播时间</option>
                    <option value="End_Date">结束时间</option>
                </select>
                <input id="dtpList_F_StartDate" type="text" style="width: 76px;" placeholder="开始时间">
                <label>-</label>
                <input id="dtpList_F_EndDate" type="text" style="width: 76px;" placeholder="结束时间">
                <select id="dtpList_F_SelectDate"></select>
                <select id="dtpList_F_IsMobile">
                    <option value="-1">直播方式</option>
                    <option value="1">手机直播</option>
                    <option value="0">PC直播</option>
                </select>
                <label>状态：</label>
                <select id="dtpList_F_Status">
                    <option value="-1">所有</option>
                    <option value="0" selected="selected">正常</option>
                    <option value="1">锁定</option>
                </select>
                <button id="dtpList_F_Btn"></button>
            </div>
        </div>
    </div>
</div>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.min.js"></script>
<script src="<%- Virtual_Path.Static %>jquery.plugin/dataTables/jquery.dataTables.bootstrap.min.js"></script>
<script>
    $(function () {
        //region 时间输入框插件
        $('#dtpList_F_StartDate, #dtpList_F_EndDate').datetimepicker({
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            minView: 2,
            autoclose: true
        });
        //endregion
        //region 绑定日期选择框
        $.KOC.Date.Select.Bind({
            eSelect: $('#dtpList_F_SelectDate'),
            eBegin: $('#dtpList_F_StartDate'),
            eEnd: $('#dtpList_F_EndDate')
        });
        //endregion
        //region dtpList
        var _dtpList = $("#dtpList").dataTable({
            'aoColumns': [
                {
                    'sWidth': '136px', 'data': 'Order_No', 'sName': 'Order_No', 'sTitle': "单据号", 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).html($('<a/>').attr('data-openwindow', cellData).text(cellData));
                    }
                },
                {
                    'sWidth': '75px', 'data': 'User_ID', 'sName': 'User_ID', 'sTitle': 'ID', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).html($('<a/>').attr('data-openwindow', ':UserAnchorInfo:' + cellData).text(cellData));
                    }
                },
                {
                    'data': 'User_NickName', 'sTitle': '昵称', 'sClass': 'center t-left', bSortable: false
                },
                {
                    'sWidth': '12%', 'data': 'Family_Name', 'sName': 'Family_ID', 'sTitle': '公会名', 'sClass': 'center t-left'
                },
                {
                    'sWidth': '55px', 'data': 'IsMobile', 'sName': 'IsMobile', 'sTitle': '播', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).html(cellData ? '<i class="fa fa-phone-square bigger-120" data-rel="tooltip" data-original-title="手机直播" />' : '<i class="fa fa-desktop bigger-120" data-rel="tooltip" data-original-title="PC端直播" />');
                    }
                },
                {
                    'sWidth': '93px', 'data': 'Coin', 'sName': 'Coin', 'sTitle': '总金币', 'sClass': 'center t-right',
                    'createdCell': function (td, cellData) {
                        if (cellData > 0) {
                            $(td).html('<span class="tooltip-" data-rel="tooltip" data-original-title="金币价值：' + $.KOC.String.ToCurrencyPositiveStr(cellData / 1000) + '">' + cellData + '</span>');
                        }
                    }
                },
                {
                    'sWidth': '93px', 'data': 'Gift_Coin', 'sName': 'Gift_Coin', 'sTitle': '礼物', 'sClass': 'center t-right',
                    'createdCell': function (td, cellData, rowData) {
                        if (cellData > 0) {
                            $(td).html('<span class="tooltip-" data-html="true" data-rel="tooltip" data-original-title="' +
                                '礼物总金币：' + cellData + '<br/>' +
                                '礼物总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(cellData / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '送给艺人总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Coin_Anchor / 1000) + '<br/>' +
                                '送给用户总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Coin_User / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Beans_Anchor / 1000) + '<br/>' +
                                '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Beans_Family / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '用户收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Beans_User / 1000) + '<br/>' +
                                '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Beans_UserFamily / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '爆奖总金币：' + rowData.Gift_Pond_Coin + '<br/>' +
                                '爆奖总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Pond_Coin / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Gift_Beans_Platform / 1000) + '<br/>">' +
                                cellData + '</span>');
                        }
                    }
                },
                {
                    'sWidth': '93px', 'data': 'Guardian_Coin', 'sName': 'Guardian_Coin', 'sTitle': '守护', 'sClass': 'center t-right',
                    'createdCell': function (td, cellData, rowData) {
                        if (cellData > 0) {
                            $(td).html('<span class="tooltip-" data-html="true" data-rel="tooltip" data-original-title="' +
                                '守护总金币：' + cellData + '<br/>' +
                                '守护总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(cellData / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Guardian_Beans_Anchor / 1000) + '<br/>' +
                                '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Guardian_Beans_Family / 1000) + '<br/>' +
                                '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Guardian_Beans_Platform / 1000) + '<br/>">' +
                                cellData + '</span>');
                        }
                    }
                },
                {
                    'sWidth': '93px', 'data': 'Horn_Coin', 'sName': 'Horn_Coin', 'sTitle': '喇叭', 'sClass': 'center t-right',
                    'createdCell': function (td, cellData, rowData) {
                        if (cellData > 0) {
                            $(td).html('<span class="tooltip-" data-html="true" data-rel="tooltip" data-original-title="' +
                                '喇叭总金币：' + cellData + '<br/>' +
                                '喇叭总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(cellData / 1000) + '<br/>' +
                                '----------------------------------------------<br/>' +
                                '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Horn_Beans_Anchor / 1000) + '<br/>' +
                                '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Horn_Beans_Family / 1000) + '<br/>' +
                                '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(rowData.Horn_Beans_Platform / 1000) + '<br/>">' +
                                cellData + '</span>');
                        }
                    }
                },
                {
                    'sWidth': '60px', 'data': 'Duration', 'sName': 'Duration', 'sTitle': '时长', 'sClass': 'center t-right'
                },
                {
                    'sWidth': '9%', 'data': 'Create_Date', 'sName': 'Create_Date', 'sTitle': '开播时间', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        $(td).text(moment(cellData).format('YY/MM/DD HH:mm'));
                    }
                },
                {
                    'sWidth': '55px', 'data': 'Status', 'sName': 'Status', 'sTitle': '状态', 'sClass': 'center',
                    'createdCell': function (td, cellData) {
                        switch (cellData) {
                            case 0:
                                $(td).html('<span class="label label-success">结束</span>');
                                break;
                            case 1:
                                $(td).html('<span class="label label-danger">直播</span>');
                                break;
                            default:
                                $(td).html('<span class="label label-default">未知</span>');
                                break;
                        }
                    }
                }
            ],
            'aaSorting': [0, 'desc'],
            'sAjaxSource': '/ajax/user.page.orderlive',
            'fnServerParams': function (aoData) {
                if (!this.arrPageFilter) {
                    this.arrPageFilter = {
                        F_DateType: $(this.selector + '_F_DateType').val(),
                        F_StartDate: $(this.selector + '_F_StartDate').val(),
                        F_EndDate: $(this.selector + '_F_EndDate').val(),
                        F_Family: $(this.selector + '_F_Family').val(),
                        F_IsMobile: $(this.selector + '_F_IsMobile').val(),
                        F_Status: $(this.selector + '_F_Status').val()
                    };
                } else {
                    $(this.selector + '_F_DateType').val(this.arrPageFilter.F_DateType);
                    $(this.selector + '_F_StartDate').val(this.arrPageFilter.F_StartDate);
                    $(this.selector + '_F_EndDate').val(this.arrPageFilter.F_EndDate);
                    $(this.selector + '_F_Family').val(this.arrPageFilter.F_Family);
                    $(this.selector + '_F_IsMobile').val(this.arrPageFilter.F_IsMobile);
                    $(this.selector + '_F_Status').val(this.arrPageFilter.F_Status);
                }
                this.ofnServerParams(aoData);
            },
            'fnFooterCallback': function (nFoot, aData) {
                var _FooterData = {
                    Coin: 0,
                    Gift_Coin: 0,
                    Gift_Coin_Anchor: 0,
                    Gift_Coin_User: 0,
                    Gift_Beans_Anchor: 0,
                    Gift_Beans_Family: 0,
                    Gift_Beans_User: 0,
                    Gift_Beans_UserFamily: 0,
                    Gift_Pond_Coin: 0,
                    Gift_Beans_Platform: 0,
                    Guardian_Coin: 0,
                    Guardian_Beans_Anchor: 0,
                    Guardian_Beans_Family: 0,
                    Guardian_Beans_Platform: 0,
                    Horn_Coin: 0,
                    Horn_Beans_Anchor: 0,
                    Horn_Beans_Family: 0,
                    Horn_Beans_Platform: 0,
                    Duration: 0
                };
                _.forEach(aData, function (ThisValue) {
                    _FooterData.Coin += ThisValue.Coin;
                    _FooterData.Gift_Coin += ThisValue.Gift_Coin;
                    _FooterData.Gift_Coin_Anchor += ThisValue.Gift_Coin_Anchor;
                    _FooterData.Gift_Coin_User += ThisValue.Gift_Coin_User;
                    _FooterData.Gift_Beans_Anchor += ThisValue.Gift_Beans_Anchor;
                    _FooterData.Gift_Beans_Family += ThisValue.Gift_Beans_Family;
                    _FooterData.Gift_Beans_User += ThisValue.Gift_Beans_User;
                    _FooterData.Gift_Beans_UserFamily += ThisValue.Gift_Beans_UserFamily;
                    _FooterData.Gift_Pond_Coin += ThisValue.Gift_Pond_Coin;
                    _FooterData.Gift_Beans_Platform += ThisValue.Gift_Beans_Platform;
                    _FooterData.Guardian_Coin += ThisValue.Guardian_Coin;
                    _FooterData.Guardian_Beans_Anchor += ThisValue.Guardian_Beans_Anchor;
                    _FooterData.Guardian_Beans_Family += ThisValue.Guardian_Beans_Family;
                    _FooterData.Guardian_Beans_Platform += ThisValue.Guardian_Beans_Platform;
                    _FooterData.Horn_Coin += ThisValue.Horn_Coin;
                    _FooterData.Horn_Beans_Anchor += ThisValue.Horn_Beans_Anchor;
                    _FooterData.Horn_Beans_Family += ThisValue.Horn_Beans_Family;
                    _FooterData.Horn_Beans_Platform += ThisValue.Horn_Beans_Platform;
                    _FooterData.Duration += ThisValue.Duration;
                });
                $(nFoot).find('[name="Coin"]').attr({
                    'data-rel': 'tooltip',
                    'data-original-title': '金币价值总计：' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Coin / 1000)
                }).text(_FooterData.Coin);
                $(nFoot).find('[name="Gift"]').attr({
                    'data-rel': 'tooltip',
                    'data-html': true,
                    'data-original-title': '礼物总金币：' + _FooterData.Gift_Coin + '<br/>' +
                    '礼物总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Coin / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '送给艺人总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Coin_Anchor / 1000) + '<br/>' +
                    '送给用户总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Coin_User / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Beans_Anchor / 1000) + '<br/>' +
                    '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Beans_Family / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '用户收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Beans_User / 1000) + '<br/>' +
                    '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Beans_UserFamily / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '爆奖总金币：' + _FooterData.Gift_Pond_Coin + '<br/>' +
                    '爆奖总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Pond_Coin / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Gift_Beans_Platform / 1000) + '<br/>'
                }).text(_FooterData.Gift_Coin);
                $(nFoot).find('[name="Guardian"]').attr({
                    'data-rel': 'tooltip',
                    'data-html': true,
                    'data-original-title': '守护总金币：' + _FooterData.Guardian_Coin + '<br/>' +
                    '守护总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Guardian_Coin / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Guardian_Beans_Anchor / 1000) + '<br/>' +
                    '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Guardian_Beans_Family / 1000) + '<br/>' +
                    '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Guardian_Beans_Platform / 1000) + '<br/>'
                }).text(_FooterData.Guardian_Coin);
                $(nFoot).find('[name="Horn"]').attr({
                    'data-rel': 'tooltip',
                    'data-html': true,
                    'data-original-title': '喇叭总金币：' + _FooterData.Horn_Coin + '<br/>' +
                    '喇叭总价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Horn_Coin / 1000) + '<br/>' +
                    '----------------------------------------------<br/>' +
                    '艺人收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Horn_Beans_Anchor / 1000) + '<br/>' +
                    '公会收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Horn_Beans_Family / 1000) + '<br/>' +
                    '平台收入价值：￥' + $.KOC.String.ToCurrencyPositiveStr(_FooterData.Horn_Beans_Platform / 1000) + '<br/>'
                }).text(_FooterData.Horn_Coin);
                $(nFoot).find('[name="Duration"]').text(_FooterData.Duration);
            },
            'fnDrawCallback': function () {
                $.Common.Bootstrap.Tooltip(this);
                this.ofnDrawCallback();
            },
            'selectOpt': {}
        });
        //endregion
    });
</script>